package com.taxsystem.gaozhuanglin.booking;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.main.taxsystem.R;
import com.taxsystem.tool.HttpUtil;

public class CommitActivity extends Activity {
	
	private EditText pwdText;
	private Button commitBtn;
	private final static String url = "";
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.commit_layout);
		
		pwdText = (EditText)findViewById(R.id.pwd);
		commitBtn = (Button)findViewById(R.id.commit);
		
		commitBtn.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				String password = pwdText.getText().toString();
				if(password==null)
				{
					Toast toast = new Toast(CommitActivity.this);
					toast.setGravity(Gravity.BOTTOM, 0, 0);
					toast.setText("请输入取票密码！");
					toast.setDuration(Toast.LENGTH_SHORT);
					toast.show();
				}
				else
				{
					//发送请求
					
					dialog();
				}
			}
		});
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main_tab, menu);
		return true;
	}
	
	protected void dialog() {
		  AlertDialog.Builder builder = new Builder(CommitActivity.this);
		  builder.setMessage("预约成功！");

		  builder.setTitle("提示");

		  builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {

		   @Override
		   public void onClick(DialogInterface dialog, int which) {
		    dialog.dismiss();
		   }
		   
		  });

		  builder.setNeutralButton("取消", new DialogInterface.OnClickListener() {

		   @Override
		   public void onClick(DialogInterface dialog, int which) {
		    dialog.dismiss();
		   }
		  });

		  builder.create().show();
		 }
}
